#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int fun(int x, int y)
{
	int i = 0;
	int t = 0;
	int k = 0;
	if (x > y)
	{
		t = y;
	}
	else
	{
		t = x ;
	}
	for (i = 1;i<=t; i++)
	{
		if (0 == x % i & 0 == y % i)
		{
			k = i;
		}
	}
	return k;
}
int main()
{
	int x = 0;
	int y = 0;
	scanf("%d%d", &x, &y);
	printf("%d", fun(x, y));
	return 0;
}